@echo off
set CMDDIR=%~dp0
set ROOT=%CMDDIR%..
set FILE=%1 %2 %3 %4 %5 %6 %7 %8 %9
set FILE="%FILE%"

md "%ROOT%\Executable" > nul 2>&1

for %%I in (%FILE%) do set EXT=%%~xI
for %%I in (%FILE%) do set FILENAME=%%~nI

echo Copying %FILENAME%%EXT% to Executable folder...
IF /I "%EXT%" == ".EXE" goto copyEXE
IF /I "%EXT%" == ".LIB" goto copyLIB
goto :copyDLL

:copyDLL
copy %FILE% "%ROOT%\Executable\"
goto end

:copyEXE
echo copy %FILE% "%ROOT%\Executable\"
copy %FILE% "%ROOT%\Executable\"
goto end

:copyLIB
echo copy %FILE% "%ROOT%\Lib\"
copy %FILE% "%ROOT%\Lib\"
goto end

:copySateliteAssemblies
copy %FILE% "%ROOT%\Executable\"
goto end

:end
if errorlevel 1 goto theend

REM Copy documentation file for developers.
REM These files should not be in bin folder for a customer packaging

if exist "%FILENAME%.xml" (
	echo Copying %FILENAME%.xml to deploy folder...
	copy "%FILENAME%.xml" "%ROOT%\Executable\" 
)

if exist "%FILENAME%.pdb" (
	echo Copying %FILENAME%.pdb to deploy folder...
	copy "%FILENAME%.pdb" "%ROOT%\Executable\"
)

if exist "%FILENAME%.exe.config" (
	echo Copying %FILENAME%.exe.config to deploy folder...
	copy "%FILENAME%.exe.config" "%ROOT%\Executable\"
)

if exist "tr\%FILENAME%.resources.dll" (
	md "%ROOT%\Executable\tr" > nul 2>&1
	echo Copying tr\%FILENAME%.resources.dll to deploy folder...
	copy "tr\%FILENAME%.resources.dll" "%ROOT%\Executable\tr"
)

if exist "tr-TR\%FILENAME%.resources.dll" (
	md "%ROOT%\Executable\tr-TR" > nul 2>&1
	echo Copying tr-TR\%FILENAME%.resources.dll to deploy folder...
	copy "tr-TR\%FILENAME%.resources.dll" "%ROOT%\Executable\tr-TR"
)

:theend
